﻿
Public Class storoomDelegate
    Inherits requestProcessor

    Public Const _pathidentity As String = "__INVALID_PATH__"

    Public Overrides Sub initial(Optional ByVal config As configParser = Nothing)
        assert(Not config Is Nothing, "storoomDelegate should be initialized with a valid configuration.")
        MyBase.initial(config)

        Dim host As String
        Dim port As Int32
        Dim retrytimes As UInt64
        host = config.parameter(configNaming.filehost.name, configNaming.filehost.storoomhost, _
                                configNaming.defaultValue.filehost.storoomhost)
        port = config.parameter(configNaming.filehost.name, configNaming.filehost.storoomport, _
                                configNaming.defaultValue.filehost.storoomport)
        retrytimes = config.parameter(configNaming.filehost.name, configNaming.filehost.storoomretrytimes, _
                                      configNaming.defaultValue.filehost.storoomretrytimes)
        storoomc.storoom.initial(host, port, retrytimes)
    End Sub

    Public Overrides Function pathidentity() As String
        Return _pathidentity
    End Function

    Public Overrides Function process(ByVal context As httpContext) As Boolean
        debugassert(False, "should not be called in storoomDelegate.")
        If Not context Is Nothing Then
            context.setstatuscode(Net.HttpStatusCode.NoContent, "NO_CONTENTE")
        End If
        Return True
    End Function
End Class
